//
//  BCOrderUnderBarCollectionViewCell.m
//  BangcaiSale
//
//  Created by Liang Zhang on 16/7/9.
//  Copyright © 2016年 Bangcai. All rights reserved.
//

#import "BCOrderUnderBarCollectionViewCell.h"

@implementation BCOrderUnderBarCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    UIColor *textColor_orange = [UIColor colorWithRed:0.949 green:0.537 blue:0.294 alpha:1.000];
    
    NSMutableAttributedString *allAttributedString = [[NSMutableAttributedString alloc] initWithString:self.allPriceLable.text];
    NSString *title0String = @"商品总额：";
    [allAttributedString addAttribute:NSForegroundColorAttributeName  //文字颜色
                                      value:[UIColor darkGrayColor]
                                      range:NSMakeRange(0, title0String.length)];
    [allAttributedString addAttribute:NSForegroundColorAttributeName  //文字颜色
                                      value:textColor_orange
                                      range:NSMakeRange(title0String.length, (self.allPriceLable.text.length-title0String.length))];
    self.allPriceLable.attributedText = allAttributedString;
    
    NSMutableAttributedString *carAttributedString = [[NSMutableAttributedString alloc] initWithString:self.carPriceLable.text];
    NSString *title1String = @"配送费：";
    [carAttributedString addAttribute:NSForegroundColorAttributeName  //文字颜色
                                value:[UIColor darkGrayColor]
                                range:NSMakeRange(0, title1String.length)];
    [carAttributedString addAttribute:NSForegroundColorAttributeName  //文字颜色
                                value:textColor_orange
                                range:NSMakeRange(title1String.length, (self.carPriceLable.text.length-title1String.length))];
    self.carPriceLable.attributedText = carAttributedString;
    
    NSMutableAttributedString *tipAttributedString = [[NSMutableAttributedString alloc] initWithString:self.tipLable.text];
    NSString *title2String = @"发票：";
    [tipAttributedString addAttribute:NSForegroundColorAttributeName  //文字颜色
                                value:[UIColor darkGrayColor]
                                range:NSMakeRange(0, title2String.length)];
    [tipAttributedString addAttribute:NSForegroundColorAttributeName  //文字颜色
                                value:textColor_orange
                                range:NSMakeRange(title2String.length, (self.tipLable.text.length-title2String.length))];
    self.tipLable.attributedText = tipAttributedString;
}

+ (instancetype)cellWithCollectionView:(UICollectionView *)collectionView {
    static NSString *ID = @"OrderUnderBarCellIdentifer";
    UINib *nib = [UINib nibWithNibName:@"BCOrderUnderBarCollectionViewCell" bundle: [NSBundle mainBundle]];
    [collectionView registerNib:nib forCellWithReuseIdentifier:ID];
    BCOrderUnderBarCollectionViewCell *cell = [[BCOrderUnderBarCollectionViewCell alloc] init];
    return cell;
}

@end
